import math
import numpy as np
import pandas as pd
from lmfit import Model, Parameters
import matplotlib.pyplot as plt
from lmfit import Model, Parameters
import matplotlib.font_manager
import matplotlib.animation as animation
from matplotlib.pyplot import figure
plt.rcParams.update({'font.size': 18})
data_10B = np.loadtxt("10B.txt")
data_10B = np.rint(data_10B)
data_10C = np.loadtxt("10C.txt")
data_10C = np.rint(data_10C)
data_10D = np.loadtxt("10D.txt")
data_10D = np.rint(data_10D)
data_11B = np.loadtxt("11B.txt")
data_11B = np.rint(data_11B)
data_11C = np.loadtxt("11C.txt")
data_11C = np.rint(data_11C)
n_10B_50 = (data_10B <50).sum()
n_10B_50_60 = ((data_10B >=50) & (data_10B<60)).sum()
n_10B_60_70 = ((data_10B >=60) & (data_10B<70)).sum()
n_10B_70_80 = ((data_10B >=70) & (data_10B<80)).sum()
n_10B_80_90 = ((data_10B >=80) & (data_10B<90)).sum()
n_10B_90_100 = ((data_10B >=90) & (data_10B<100)).sum()
n_10B_100 = (data_10B == 100 ).sum()
n_10B_avg, n_10B_std = np.mean(data_10B), np.std(data_10B)
print("Physics Grade for 10B")
print("The number of students who scored less than 50 is: ", n_10B_50)
print("The number of students who scored between 50 and 60 is: ", n_10B_50_60)
print("The number of students who scored between 60 and 70 is: ", n_10B_60_70)
print("The number of students who scored between 70 and 80 is: ", n_10B_70_80)
print("The number of students who scored between 80 and 90 is: ", n_10B_80_90)
print("The number of students who scored between 90 and 100 is: ", n_10B_90_100)
print("The number of students who scored 100 is: ", n_10B_100)
print("The average and standard deviation is: ", n_10B_avg, " and ",n_10B_std," respectively.")
Physics Grade for 10B The number of students who scored less than 50 is: 0 The number of students who scored between 50 and 60 is: 10 The number of students who scored between 60 and 70 is: 23 The number of students who scored between 70 and 80 is: 15 The number of students who scored between 80 and 90 is: 11 The number of students who scored between 90 and 100 is: 3 The number of students who scored 100 is: 2 The average and standard deviation is: 71.421875 and 11.491579372931076 respectively.
n_10C_50 = (data_10C <50).sum()
n_10C_50_60 = ((data_10C >=50) & (data_10C<60)).sum()
n_10C_60_70 = ((data_10C >=60) & (data_10C<70)).sum()
n_10C_70_80 = ((data_10C >=70) & (data_10C<80)).sum()
n_10C_80_90 = ((data_10C >=80) & (data_10C<90)).sum()
n_10C_90_100 = ((data_10C >=90) & (data_10C<100)).sum()
n_10C_100 = (data_10C == 100 ).sum()
n_10C_avg, n_10C_std = np.mean(data_10C), np.std(data_10C)
print("Physics Grade for 10C")
print("The number of students who scored less than 50 is: ", n_10C_50)
print("The number of students who scored between 50 and 60 is: ", n_10C_50_60)
print("The number of students who scored between 60 and 70 is: ", n_10C_60_70)
print("The number of students who scored between 70 and 80 is: ", n_10C_70_80)
print("The number of students who scored between 80 and 90 is: ", n_10C_80_90)
print("The number of students who scored between 90 and 100 is: ", n_10C_90_100)
print("The number of students who scored 100 is: ", n_10C_100)
print("The average and standard deviation is: ", n_10C_avg, " and ",n_10C_std," respectively.")
Physics Grade for 10C The number of students who scored less than 50 is: 0 The number of students who scored between 50 and 60 is: 5 The number of students who scored between 60 and 70 is: 25 The number of students who scored between 70 and 80 is: 21 The number of students who scored between 80 and 90 is: 10 The number of students who scored between 90 and 100 is: 3 The number of students who scored 100 is: 1 The average and standard deviation is: 71.44615384615385 and 10.457284202861098 respectively.
n_10D_50 = (data_10D <50).sum()
n_10D_50_60 = ((data_10D >=50) & (data_10D<60)).sum()
n_10D_60_70 = ((data_10D >=60) & (data_10D<70)).sum()
n_10D_70_80 = ((data_10D >=70) & (data_10D<80)).sum()
n_10D_80_90 = ((data_10D >=80) & (data_10D<90)).sum()
n_10D_90_100 = ((data_10D >=90) & (data_10D<100)).sum()
n_10D_100 = (data_10D == 100 ).sum()
n_10D_avg, n_10D_std = np.mean(data_10D), np.std(data_10D)
print("Physics Grade for 10D")
print("The number of students who scored less than 50 is: ", n_10D_50)
print("The number of students who scored between 50 and 60 is: ", n_10D_50_60)
print("The number of students who scored between 60 and 70 is: ", n_10D_60_70)
print("The number of students who scored between 70 and 80 is: ", n_10D_70_80)
print("The number of students who scored between 80 and 90 is: ", n_10D_80_90)
print("The number of students who scored between 90 and 100 is: ", n_10D_90_100)
print("The number of students who scored 100 is: ", n_10D_100)
print("The average and standard deviation is: ", n_10D_avg, " and ",n_10D_std," respectively.")
Physics Grade for 10D The number of students who scored less than 50 is: 0 The number of students who scored between 50 and 60 is: 3 The number of students who scored between 60 and 70 is: 24 The number of students who scored between 70 and 80 is: 25 The number of students who scored between 80 and 90 is: 5 The number of students who scored between 90 and 100 is: 5 The number of students who scored 100 is: 1 The average and standard deviation is: 72.15873015873017 and 10.043091835963583 respectively.
n_11B_50 = (data_11B <50).sum()
n_11B_50_60 = ((data_11B >=50) & (data_11B<60)).sum()
n_11B_60_70 = ((data_11B >=60) & (data_11B<70)).sum()
n_11B_70_80 = ((data_11B >=70) & (data_11B<80)).sum()
n_11B_80_90 = ((data_11B >=80) & (data_11B<90)).sum()
n_11B_90_100 = ((data_11B >=90) & (data_11B<100)).sum()
n_11B_100 = (data_11B == 100 ).sum()
n_11B_avg, n_11B_std = np.mean(data_11B), np.std(data_11B)
print("Physics Grade for 11B")
print("The number of students who scored less than 50 is: ", n_11B_50)
print("The number of students who scored between 50 and 60 is: ", n_11B_50_60)
print("The number of students who scored between 60 and 70 is: ", n_11B_60_70)
print("The number of students who scored between 70 and 80 is: ", n_11B_70_80)
print("The number of students who scored between 80 and 90 is: ", n_11B_80_90)
print("The number of students who scored between 90 and 100 is: ", n_11B_90_100)
print("The number of students who scored 100 is: ", n_11B_100)
print("The average and standard deviation is: ", n_11B_avg, " and ",n_11B_std," respectively.")
Physics Grade for 11B The number of students who scored less than 50 is: 0 The number of students who scored between 50 and 60 is: 0 The number of students who scored between 60 and 70 is: 11 The number of students who scored between 70 and 80 is: 17 The number of students who scored between 80 and 90 is: 16 The number of students who scored between 90 and 100 is: 4 The number of students who scored 100 is: 0 The average and standard deviation is: 77.02083333333333 and 8.908071207556038 respectively.
n_11C_50 = (data_11C <50).sum()
n_11C_50_60 = ((data_11C >=50) & (data_11C<60)).sum()
n_11C_60_70 = ((data_11C >=60) & (data_11C<70)).sum()
n_11C_70_80 = ((data_11C >=70) & (data_11C<80)).sum()
n_11C_80_90 = ((data_11C >=80) & (data_11C<90)).sum()
n_11C_90_100 = ((data_11C >=90) & (data_11C<100)).sum()
n_11C_100 = (data_11C == 100 ).sum()
n_11C_avg, n_11C_std = np.mean(data_11C), np.std(data_11C)
print("Physics Grade for 11C")
print("The number of students who scored less than 50 is: ", n_11C_50)
print("The number of students who scored between 50 and 60 is: ", n_11C_50_60)
print("The number of students who scored between 60 and 70 is: ", n_11C_60_70)
print("The number of students who scored between 70 and 80 is: ", n_11C_70_80)
print("The number of students who scored between 80 and 90 is: ", n_11C_80_90)
print("The number of students who scored between 90 and 100 is: ", n_11C_90_100)
print("The number of students who scored 100 is: ", n_11C_100)
print("The average and standard deviation is: ", n_11C_avg, " and ",n_11C_std," respectively.")
Physics Grade for 11C The number of students who scored less than 50 is: 0 The number of students who scored between 50 and 60 is: 1 The number of students who scored between 60 and 70 is: 13 The number of students who scored between 70 and 80 is: 18 The number of students who scored between 80 and 90 is: 14 The number of students who scored between 90 and 100 is: 2 The number of students who scored 100 is: 2 The average and standard deviation is: 76.94 and 10.092393175060115 respectively.
plt.hist(data_10B)
plt.xlabel("Score")
plt.ylabel("Number of Students")
plt.title("Physics Grade (10B)")
plt.savefig('img/10B.png', bbox_inches='tight', pad_inches=1)
plt.show()
plt.hist(data_10C)
plt.xlabel("Score")
plt.ylabel("Number of Students")
plt.title("Physics Grade (10C)")
plt.savefig('img/10C.png', bbox_inches='tight', pad_inches=1)
plt.show()
plt.hist(data_10D)
plt.xlabel("Score")
plt.ylabel("Number of Students")
plt.title("Physics Grade (10D)")
plt.savefig('img/10D.png', bbox_inches='tight', pad_inches=1)
plt.show()
plt.hist(data_11B)
plt.xlabel("Score")
plt.ylabel("Number of Students")
plt.title("Physics Grade (11B)")
plt.savefig('img/11B.png', bbox_inches='tight', pad_inches=1)
plt.show()
plt.hist(data_11C)
plt.xlabel("Score")
plt.ylabel("Number of Students")
plt.title("Physics Grade (11C)")
plt.savefig('img/11C.png', bbox_inches='tight', pad_inches=1)
plt.show()